package com.nbsaas.boot.order.rest.resource;

import com.nbsaas.boot.order.api.apis.OrderCouponApi;
import com.nbsaas.boot.order.data.entity.OrderCoupon;
import com.nbsaas.boot.order.api.domain.request.OrderCouponRequest;
import com.nbsaas.boot.order.api.domain.response.OrderCouponResponse;
import com.nbsaas.boot.order.api.domain.simple.OrderCouponSimple;
import com.nbsaas.boot.order.rest.convert.OrderCouponSimpleConvert;
import com.nbsaas.boot.order.rest.convert.OrderCouponEntityConvert;
import com.nbsaas.boot.order.rest.convert.OrderCouponResponseConvert;
import com.nbsaas.boot.order.data.repository.OrderCouponRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   订单优惠券-业务接口实现
*/
@Transactional
@Service
public class OrderCouponResource extends BaseResource<OrderCoupon,OrderCouponResponse, OrderCouponSimple, OrderCouponRequest>  implements OrderCouponApi {

    @Resource
    private OrderCouponRepository orderCouponRepository;

    @Override
    public JpaRepositoryImplementation<OrderCoupon, Serializable> getJpaRepository() {
        return orderCouponRepository;
    }

    @Override
    public Function<OrderCoupon, OrderCouponSimple> getConvertSimple() {
        return new OrderCouponSimpleConvert();
    }

    @Override
    public Function<OrderCouponRequest, OrderCoupon> getConvertForm() {
        return new OrderCouponEntityConvert();
    }

    @Override
    public Function<OrderCoupon, OrderCouponResponse> getConvertResponse() {
        return new OrderCouponResponseConvert();
    }




}


